﻿
using System.Data;
using System.Data.Entity.Infrastructure;
using Quba.DataAccess.Repositories.Abstract;
using Quba.Entities.Database.User;

namespace Quba.DataAccess.Repositories.Concrete
{
    public class CandidateRepository : QubaBaseRepositoty<Candidate>, ICandidateRepository
    {
        private Candidate _result;

        #region Get
        public override Candidate Get(int candidateId)
        {
            return _GetQubaContext().Candidates.Find(candidateId);
        }
        #endregion Get

        #region Update
        public override Candidate Update(Candidate candidate)
        {
            _result = _GetQubaContext().Candidates.Add(candidate);
            DbEntityEntry entry = _GetQubaContext().Entry(candidate);
            entry.State = EntityState.Modified;

            _GetQubaContext().SaveChanges();
            return _result;
        }
        #endregion Update
    }
}